﻿Public Class xtf_LISTADOtipoemail_

    Public Overrides Sub IniciarLista()
        Try
            gdc_general.BeginUpdate()
            gdc_general.DataSource = dtt_DataTable
            'ulg_Lista.DisplayLayout.GroupByBox.Style = Infragistics.Win.UltraWinGrid.GroupByBoxStyle.Full

            'Creacion y carga de Cuentas
            dtt_DataTable.Columns.Add("Identificador (ID)")
            dtt_DataTable.Columns.Add("Nombre")
            dtt_DataTable.Columns.Add("Nombre Corto")

            gdv_general.PopulateColumns(dtt_DataTable)

            Dim obj_TipoEMail_ As New cls_TipoEMail_
            If obj_TipoEMail_.CargarTodos(ObtenerRegistroEstado) Then
                For Each TipoEMail As cls_tipoemail_ In obj_TipoEMail_.Items
                    AgregarItem(TipoEMail)
                Next
            End If
            'ulg_Lista.DataBind()

            FiltrarColumnas()
            gdc_general.EndUpdate()
        Catch ex As Exception
            'Dim frmError As New frm_ErrorManager(ex.Message)
        End Try
    End Sub

    Public Function AgregarItem(ByRef TipoEMail As cls_tipoemail_) As DataRow
        Dim Row As DataRow = dtt_DataTable.NewRow
        Row("Identificador (ID)") = TipoEMail.idTipoEMail
        Row("Nombre") = TipoEMail.nombre
        Row("Nombre corto") = TipoEMail.nombrecorto

        dtt_DataTable.Rows.Add(Row)
        'ulg_Lista.Rows(ulg_Lista.Rows.Count - 1).Height = 19
        Return Row
    End Function

    Public Sub ModificarItem(ByRef TipoEMail As cls_tipoemail_, ByRef ulg_row As DataRow)
        ulg_row("Identificador (ID)") = TipoEMail.idTipoEMail
        ulg_row("Nombre") = TipoEMail.nombre
        ulg_row("Nombre corto") = TipoEMail.nombrecorto
    End Sub

    Public Sub New()

        Me.Cursor = Cursors.WaitCursor
        InitializeComponent()
        PERMISONuevo = "001016002"
        PERMISOModificar = "001016003"
        PERMISOEliminar = "001016004"
        PERMISOImprimir = "001016005"
        Me.Text = lbl_modulo.Text : lbl_modulodescripcion.Text = "Listado de " & lbl_modulo.Text & "."
        IniciarLista()
        Me.Cursor = Cursors.Default

    End Sub

End Class